import request from './request.js'

// 商品分类模块接口集合

/**
 * 添加分类
 * @param {Object} data 商品分类信息接收类
 */
export const saveCategories = (data) => {
	return request.post('/shopping/categories', data)
}

/**
 * 修改分类
 * @param {Object} data 商品分类信息接收类
 */
export const updateCategories = (data) => {
	return request.put('/shopping/categories', data)
}

/**
 * 获取分类分页数据
 * @param {Object} data 分类分页前端接受类
 */
export const getCategoriesPage = (data) => {
	return request.post('/shopping/categories/page', data)
}

/**
 * 删除分类
 * @param {String} id 分类id
 */
export const deleteCategories = (id) => {
	return request.delete(`/shopping/categories/${id}`)
}

/**
 * 获取所有分类的ID和名字
 */
export const getAllCategoriesName = () => {
  return request.get('/shopping/categories')
}

/**
 * 获取分类详情
 */
export const getCategoriesDetails = (id) => {
  return request.get(`/shopping/categories/${id}`)
}